io.write('YuanJinZhi  N=')
n=io.read()
io.write('YuanJinZhi  Shu x=')
x=io.read()

a=string.len(x)-1
s=0
for i=1,string.len(x) do
	s=s+string.sub(x,i,i)*n^a
	a=a-1
end

io.write(s)	
print()
